<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!doctype html>
<html>
<head>
<style type="text/css">
* {
	margin: 0px;
	padding: 0px;
	font-size: 12px;
}
</style>
</head>
<body class="gray-bg">

	<!-- 隐藏域 -->
	<input type="hidden" id="busiId" name="busiId" value="${busiId}" />
	<input type="hidden" id="id" name="id" value="${id}" />
	<!-- 隐藏域 -->

	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;财务相关>确认退押金</span>
		</div>
		<div class="ibox-content ibox-con">
			<%@include file="/jsp/common_yw_with_loan_include.jsp"%>
			<div class="business-manwife">退押金信息</div>
			<div class="business-padding">
				<table cellpadding="0" cellspacing="0" border="0" class="table-list">
					<tr>
						<td>签约贷款额</td>
						<td id="sign_loan_amount" name="sign_loan_amount">&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>还款情况</td>
						<td id="yq_count" name="yq_count">&nbsp;</td>
						<td id="jq_count" name="jq_count">&nbsp;</td>
						<td>当前逾期<span id="amount_remainder"></span>元
						</td>
					</tr>
					<tr>
						<td>征信押金</td>
						<td id="credit_real" name="credit_real">&nbsp;</td>
						<td>续保押金</td>
						<td id="deposit_insure_real" name="deposit_insure_real">&nbsp;</td>
					</tr>
					<tr>
						<td>履约押金</td>
						<td id="deposit_performing_real" name="deposit_performing_real">&nbsp;</td>
						<td>抵押押金</td>
						<td id="deposit_real" name="deposit_real">&nbsp;</td>
					</tr>
				</table>
			</div>
			<div class="business-padding">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table">
					<tr>
						<td align="right"><label class="control-label np">退款项目：</label>
						</td>
						<td><input id="typeRefund" name="typeRefund" minlength="1"
							maxlength="20" type="text" class="form-control" required=""
							aria-required="true" placeholder="退款项目" readonly="readonly">
						</td>
						<td align="right"><label class="control-label np">退款银行：</label>
						</td>
						<td><input id="bank" name="bank" minlength="1" maxlength="20"
							type="text" class="form-control" required="" aria-required="true"
							placeholder="退款银行" readonly="readonly"></td>
					</tr>
					<tr>
						<td align="right"><label class="control-label np">退款单位：</label>
						</td>
						<td><input id="departmentRefund" name="departmentRefund"
							minlength="1" maxlength="20" type="text" class="form-control"
							required="" aria-required="true" placeholder="退款单位"
							readonly="readonly"></td>
						<td align="right"><label class="control-label np">银行账号：</label>
						</td>
						<td><input id="cardnoRefund" name="cardnoRefund"
							minlength="1" maxlength="20" type="creditcard"
							class="form-control" required="" aria-required="true"
							placeholder="银行账号" readonly="readonly"></td>
					</tr>
					<tr>
						<td align="right"><label class="control-label np">申请金额：</label>
						</td>
						<td><input id="amountApply" name="amountApply" minlength="1"
							maxlength="20" type="digits" class="form-control" required=""
							aria-required="true" placeholder="申请金额" readonly="readonly">
						</td>
						<td align="right"><label class="control-label np">实际金额：</label>
						</td>
						<td><input id="amountRefund" name="amountRefund"
							minlength="1" maxlength="20" type="digits" class="form-control"
							required="" aria-required="true" placeholder="实际金额"
							readonly="readonly"></td>
					</tr>
					<tr>
						<td align="right"><label class="control-label np">退款方式：</label>
						</td>
						<td><input id="typeRemit" name="typeRemit" minlength="1"
							maxlength="20" type="digits" class="form-control" required=""
							aria-required="true" placeholder="实际金额" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td align="right">&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td align="right" valign="top"><label
							class="control-label np">备注：</label></td>
						<td colspan="3"><textarea id="remarks" name="remarks"
								class="textarea-control" required="" aria-required="true"
								disabled="disabled"></textarea></td>
					</tr>
				</table>
				</form>
			</div>
			<div class="business-manwife">代垫附件</div>
			<div class="business-padding">
				<div class="zx-addimg">
					<ul id="TUI_KUAN_FU_JIAN">
						<li>
							<img filelabel="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }"
							src="${basePath}/img/shangchuanzhaopian.png" width="110px" height="110px" class="zx-imgPre ${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }">
							<span filelabelDelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }" class="hidden bt-cancle glyphicon glyphicon-trash" onclick="deleleFileRecord(this,'${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN1 }',false);"></span>
							<div class="img-layer">
								<div></div>
								<span filelabelLabelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }">${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN1 }</span>
							</div>
							<div filelabelDiv="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }" class="hidden button-des">
								<a type="button" class="abuttonStylele"  filelabelADown="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }" download="shangchuanzhaopian.png" href="${basePath}/img/shangchuanzhaopian.png" >下载</a>
								<a type="button" class="abuttonStyleri" onclick="showImg(this);">详情</a>
							</div>
							<a href="javascript:void(0);" class="file">
								<input type="file"  accept="image/gif,image/jpeg,image/bmp,image/png,image/jpg"  onchange="uploadFile(this,'${modeIDTypeNames.TUIKUAN}','TUI_KUAN_FU_JIAN',false, false,null,null,'${uuid}');"/>
							</a>
						</li>
						
						<li>
							<img filelabel="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }"
							src="${basePath}/img/shangchuanzhaopian.png" width="110px" height="110px" class="zx-imgPre ${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }">
							<span filelabelDelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }" class="hidden bt-cancle glyphicon glyphicon-trash" onclick="deleleFileRecord(this,'${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN2 }',false);"></span>
							<div class="img-layer">
								<div></div>
								<span filelabelLabelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }">${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN2 }</span>
							</div>
							<div filelabelDiv="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }" class="hidden button-des">
								<a type="button" class="abuttonStylele"  filelabelADown="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }" download="shangchuanzhaopian.png" href="${basePath}/img/shangchuanzhaopian.png" >下载</a>
								<a type="button" class="abuttonStyleri" onclick="showImg(this);">详情</a>
							</div>
							<a href="javascript:void(0);" class="file">
								<input type="file" accept="image/gif,image/jpeg,image/bmp,image/png,image/jpg"   onchange="uploadFile(this,'${modeIDTypeNames.TUIKUAN}','TUI_KUAN_FU_JIAN',false, false,null,null,'${uuid}');" />
							</a>
						</li>
						
					</ul>
				</div>
			</div>
			<div class="business-manwife">
				<span>财务退款</span>
				<div class="buttonfixed" id="save"> 
					<button type="button" class="btn dpbtn_blue btnaplly" onclick="save();">确认退押金</button>
				</div>
			</div>
			<div class="padding-nono">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table">
					<tr>
						<td align="right"><label class="control-label np">打款时间：</label>
						</td>
						<td><input id="timeRemit" name="timeRemit" placeholder="财务审核时间"
							class="laydate-icon form-control" onclick="laydate()" /></td>
						<td align="right"><label class="control-label np">退款账号：</label>
						</td>
						<td><select class="select-control" id="cardno_refund_company"
							name="cardno_refund_company">&nsbp;
						</select></td>
					</tr>
				</table>
			</div>

			<div class="business-manwife">经办信息</div>
			<div class="padding-nono">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table">
					<tr>
						<td align="right"><label class="control-label np">经办人：</label>
						</td>
						<td><input class="form-control" type="text" id="uname"
							name="uname" readonly="readonly"
							value="${current_user_key.uname}" /></td>
						<td align="right"><label class="control-label np">经办时间：</label>
						</td>
						<td><input id="jb_time" name="jb_time" placeholder="经办时间"
							class="laydate-icon form-control" readonly="readonly"/></td>
					</tr>
				</table>
			</div>
			</form>
		</div>
	</div>
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>
	<!-- layerDate plugin javascript -->
	<script type="text/javascript" src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>
	<!-- 文件上传 -->
	<%@include file="/jsp/common_fileupload_include.jsp"%>

	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	
    	$(function(){
    		var date = new Date();
	    	document.getElementById("jb_time").value = date.format("yyyy-MM-dd h:m:s");
	    	var busiId = $('#busiId').val();
	    	showAttentment(busiId, null, '${modeIDTypeNames.TUIKUAN}');
	    	initData(); 
    	});
    	
    	
    	var initData = function()
    	{
    		 //附件
    		 var id = $('#id').val();
    		 var busiId = $('#busiId').val();
			 
			 $.dpAjax({
			   		url:'${basePath}/CaiWuXiangGuanController/caiWuXiangGuanKeHuTuiYaJin',
			   		data:{
			   			"busiId":busiId,
			   			"id":id
			   		},
					success: function(datas)
					{
				 	  if(datas.flag == "100100")
				 	  {
				 		  layer.msg(datas.message, {icon: 1});
				 		  var ywBusiness = datas.ywBusiness;
				 		  if(ywBusiness)
				 		  {
				 			  $('#sign_loan_amount').html(ywBusiness.signLoanAmount);
				 		  }
				 		
				 		  var cwIncomeExpensesItem = datas.cwIncomeExpensesItem;
				 		
				 		  if(cwIncomeExpensesItem)
				 		  {
				 			  for(var i=0;i<cwIncomeExpensesItem.length;i++)
				 			  {
				 				  var pp = cwIncomeExpensesItem[i];
				 				  
				 				  var item_code = pp['item_code'];
				 				  var amount_item = pp['amount_item'];
				 				  
				 				  if(item_code == "25")
				 				  {
				 					   //续保押金  25
				 					   $('#deposit_insure_real').html(amount_item);
				 				  }
				 				  else if(item_code == "03")
				 				  {
				 					  //履约押金  03
				 					  $('#deposit_performing_real').html(amount_item);
				 				  }
				 				  else if(item_code == "29")
				 				  {
				 					  //抵押押金  29
				 					  $('#deposit_real').html(amount_item);
				 				  }
				 				  else if(item_code == "34")
				 				  {
				 					  //征信押金  34
				 					  $('#credit_real').html(amount_item);
				 				  }
				 			  }
				 		  }
				 		  
				 		  var dhDepositMoney = datas.dhDepositMoney;
				 		  if(dhDepositMoney)
				 		  {
				 			  $('#typeRefund').val(dhDepositMoney.typeRefund);
					 		  $('#bank').val(dhDepositMoney.bank);
					 		  $('#departmentRefund').val(dhDepositMoney.departmentRefund);
					 		  $('#cardnoRefund').val(dhDepositMoney.cardnoRefund);
					 		  $('#amountApply').val(dhDepositMoney.amountApply);
					 		  $('#amountRefund').val(dhDepositMoney.amountRefund);
					 		  $('#typeRemit').val(dhDepositMoney.typeRemit);
					 		  $('#remarks').val(dhDepositMoney.remarks)
					 		  $('#timeRemit').val(dhDepositMoney.timeRemit);
					 		  
					 		  
					 		  if(dhDepositMoney.statusRefundDeposit == 100)
					 		  {
					 			 $('#save').hide();
					 			 $("#timeRemit").attr("disabled","disabled");
					 			 $('#cardno_refund_company').html('<option value="'+dhDepositMoney.cardnoRefundCompany+'">'+dhDepositMoney.cardnoRefundCompany+'</option>');
					 		  }
				 		  }
				 		  
				 		  if(dhDepositMoney.statusRefundDeposit == 50)
				 		  {
				 			  var gongsiCarad = datas.gongsiCarad;
					 		  if(gongsiCarad)
					 		  {
					 			  var objs = '';
						 		  for(var key in gongsiCarad)  
						 		  {
						 			objs += '<option value="'+gongsiCarad[key]+'">'+gongsiCarad[key]+'</option>';
						 		  }
						 		  $('#cardno_refund_company').html(objs);
					 		  }
				 		  }
						  return;
					  }
					  if(datas.flag == "100200"){
						  alert(JSON.stringify(datas));
			              return;
			          }
					  layer.msg(datas.message, {icon: 2});
					}
			 });
    	}
    	
    	var save = function()
    	{
    		var id = $('#id').val();
    		var cardno_refund_company = $('#cardno_refund_company').val();
    		layer.confirm('确定执行本次操作？操作人：<span style="color:#BD1723;">${current_user_key.uname}</span>', {
    			  btn: ['确定','取消'],//按钮
	  	    	  title: '退押金消息',
	    			},function(){
	    			layer.closeAll();	
		    		$.dpAjax({
					   		url:'${basePath}/CaiWuXiangGuanController/modify',
					   		data:{
					   			"id":id,
					   			"cardnoRefundCompany":cardno_refund_company
					   		},
							success: function(datas)
							{
						 	  if(datas.flag == "100100")
						 	  {
						 		  layer.msg(datas.message, {icon: 1});
						 		  setTimeout(function () {
						 			window.location.href = "${basePath}/web/caiWuXiangGuan/customerMonReturnList.jsp";
						 		  }, 3000);
								 return;
							  }
							  if(datas.flag == "100200"){
								  alert(JSON.stringify(datas));
					              return;
					          }
							  layer.msg(datas.message, {icon: 2});
							}
					 });
	    		},function(){
	    			layer.msg("已取消本次操作！", {icon: 6});
	    		});	
    	}
    </script>
</body>
</html>
